package cn.itcast.hotel.controller;

import cn.itcast.hotel.pojo.PageResult;
import cn.itcast.hotel.pojo.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author mrchen
 * @date 2022/6/17 15:58
 */
@RestController
@RequestMapping("hotel")
public class HotelController {
    @Autowired
    IHotelService hotelService;

    @PostMapping("list")
    public PageResult list(@RequestBody RequestParams params){
        return hotelService.search(params);
    }

    @PostMapping("filters")
    public Map<String, List<String>> getFilters(@RequestBody RequestParams params){
        return hotelService.getFilters(params);
    }


    @GetMapping("suggestion")
    public List<String>  suggestion(@RequestParam String key){
        return hotelService.suggestion(key);
    }

}
